package com.example.utils;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

//经常用到的常量
public class Const {
    public static final String JWT_BLACK_LIST = "jwt:blacklist:";

    public static final String VERIFY_EMAIL_LIMIT = "verify:email:limit:";
    public static final String VERIFY_EMAIL_DATA = "verify:email:data:";

    // 跨域问题的优先级
    public static final int ORDER_CORS = -102;
    // 限流过滤器的优先级
    public static final int ORDER_LIMIT = -101;
    // ReqRecordFilter 的优先级
    public static final int ORDER_REQ = -103;

    public static final String FLOW_LIMIT_COUNTER = "flow:counter:";
    public static final String FLOW_LIMIT_BLOCK = "flow:block:";

    //论坛相关
    public static final String FORUM_IMAGE_COUNTER = "forum:image:";
    public static final String FORUM_TOPIC_CREATE_COUNTER = "forum:topic:create:";

    public final static String FORUM_TOPIC_PREVIEW_CACHE = "topic:preview:";

    public final static String FORUM_TOPIC_COMMENT_COUNTER = "forum:topic:comment:";

    //活跃度相关
    public final static String FORUM_RANK_INTERACT= "forum:rank:comment:interact:";

    //Rabbit
    public final static String FORUM_RANK = "rank";

    // pv/uv 相关
    public final static String SITE_VISIT_KEY = "visit_info";
    public static String day(LocalDate day) {
        return DateTimeFormatter.ofPattern("yyyyMMdd").format(day);
    }

    // 用户在线
    public final static String ACCOUNT_ALIVE = "account:alive";
}
